home *** CD-ROM | disk | FTP | other *** search
- #import <3dreality_api.h>
-
- @implementation QuadricInspector
- - loadShape:(Shape *)shape inView:(Camera *)camera
- {
- if (shape) {
- [super loadShape:shape inView:camera];
- if ([shape isKindOf:[Quadric class]]) {
- if (radiusSlider)[radiusSlider setFloatValue:
- [(Quadric *)shape radius]*worldScale];
- if(thetaMaxSlider)[thetaMaxSlider setFloatValue:
- [(Quadric *)shape thetaMax]];
- if(zMinSlider)[zMinSlider setFloatValue:
- [(Quadric *)shape zMin]*worldScale];
- if (zMaxSlider)[zMaxSlider setFloatValue:
- [(Quadric *)shape zMax]*worldScale];
- }
- }
- return self;
- }
-
- - rescaleSliders:(float)value
- {
- [self rescaleSlider:radiusSlider factorBy:value];
- [self rescaleSlider:zMinSlider factorBy:value];
- [self rescaleSlider:zMaxSlider factorBy:value];
- return self;
- }
-
- - changeRadius:sender
- {
- Shape *shape = [self selectedShape];
- if (shape && [shape isKindOf:[Quadric class]]) {
- RtFloat value = [sender floatValue]/worldScale;
- [(Quadric *)shape setRadius:&value];
- [self displayChanges];
- }
- return self;
- }
-
- - changeThetaMax:sender
- {
- Shape *shape = [self selectedShape];
- if (shape && [shape isKindOf:[Quadric class]]) {
- RtFloat value = [sender floatValue];
- [(Quadric *)shape setThetaMax:&value];
- [self displayChanges];
- }
- return self;
- }
-
- - changeZMin:sender
- {
- Shape *shape = [self selectedShape];
- if (shape && [shape isKindOf:[Quadric class]]) {
- RtFloat value = [sender floatValue]/worldScale;
- [(Quadric *)shape setZMin:&value];
- [self displayChanges];
- }
- return self;
- }
-
- - changeZMax:sender
- {
- Shape *shape = [self selectedShape];
- if (shape && [shape isKindOf:[Quadric class]]) {
- RtFloat value = [sender floatValue]/worldScale;
- [(Quadric *)shape setZMax:&value];
- [self displayChanges];
- }
- return self;
- }
-
- - setRadiusSlider:anObject
- {
- radiusSlider = anObject;
-
- [anObject setUpTarget:self action:@selector(changeRadius:)];
- [anObject setAltStep:.005 whole:NO default:.025];
- [anObject setMax:.5 allowHigher:YES min:0. allowLower:YES];
- [anObject setFloatValue:.025];
-
- return self;
- }
-
- - setThetaMaxSlider:anObject
- {
- thetaMaxSlider = anObject;
-
- [anObject setUpTarget:self action:@selector(changeThetaMax:)];
- [anObject setAltStep:5 whole:YES default:360];
- [anObject setMax:360 allowHigher:NO min:0. allowLower:YES];
- [anObject setFloatValue:360.];
-
- return self;
- }
-
- - setZMinSlider:anObject
- {
- zMinSlider = anObject;
-
- [anObject setUpTarget:self action:@selector(changeZMin:)];
- [anObject setAltStep:.01 whole:NO default:.05];
- [anObject setMax:.2 allowHigher:YES min:0. allowLower:YES];
- [anObject setFloatValue:.025];
-
- return self;
- }
-
- - setZMaxSlider:anObject
- {
- zMaxSlider = anObject;
-
- [anObject setUpTarget:self action:@selector(changeZMax:)];
- [anObject setAltStep:.01 whole:NO default:.05];
- [anObject setMax:.2 allowHigher:YES min:0. allowLower:YES];
- [anObject setFloatValue:.05];
-
- return self;
- }
- @end
-